{include file='public/meta'}
  <title>管理员列表 - 管理员添加 - 木鱼内容管理系统</title>
</head>
<body>
  <div class="layui-form" lay-filter="layuiadmin-form-role" id="layuiadmin-form-role" style="padding: 20px 30px 0 0;">
    <div class="layui-form-item">
      <label class="layui-form-label">管理员</label>
      <div class="layui-input-block">
        <input type="text" name="name" id="name" placeholder="请输入管理员用户名" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">头像</label>
      <div class="layui-input-block">
          <button type="button" class="layui-btn" id="test1">上传图片</button>
          <input class="layui-upload-file" type="file" accept="images" name="file">
          <div class="layui-input-inline" style="float:left;width:45%;">
          <input class="layui-input" type="text" accept="images" id="photo" name="photo">
          </div>
          <div class="layui-upload-list">
            <img class="layui-upload-img" id="demo1">
            <p id="demoText"></p>
          </div>
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">密码</label>
      <div class="layui-input-block">
        <input type="password" name="password" id="password" placeholder="请输入管理员初始密码" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">确认密码</label>
      <div class="layui-input-block">
        <input type="password" name="passwords" id="passwords" placeholder="请输入管理员确认密码" class="layui-input">
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">角色组</label>
      <div class="layui-input-block">
        <select class="select" name="roles">
		{foreach $rolename as $val}
			<option value="{$val.id}">{$val.name}</option>
		{/foreach}
		</select>
      </div>
    </div>

    <div class="layui-form-item">
      <label class="layui-form-label">邮箱</label>
      <div class="layui-input-block">
        <input type="text" name="email" id="email" placeholder="请输入管理员邮箱" class="layui-input">
      </div>
    </div>
        <div class="layui-form-item">
      <label class="layui-form-label">手机</label>
      <div class="layui-input-block">
        <input type="text" name="phone" id="phone" placeholder="请输入管理员手机号码" class="layui-input">
      </div>
    </div>
        <div class="layui-form-item">
      <label class="layui-form-label">简介</label>
      <div class="layui-input-block">
        <textarea type="text" name="intro" id="intro" class="layui-textarea" placeholder="请输入管理员简介,最多为50个字符"></textarea>
      </div>
    </div>
    <div class="layui-form-item layui-hide">
      <button class="layui-btn" lay-submit lay-filter="muyu-ajax-submit" id="muyu-ajax-submit">提交</button>
    </div>
  </div>
<style type="text/css" media="all">
/*上传头像样式开始*/
.layui-upload-img{width: 92px; height: 92px; margin: 0 10px 10px 0;}
/*上传头像样式结束*/
</style>
<!-- 低部区域 -->
{include file='public/footer'}
  <script>
  layui.config({
    base: '__ADMINST__layuiadmin/' //静态资源所在路径
    ,version: new Date().getTime()
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form'], function(){
    var $ = layui.$
    ,form = layui.form ;
  })
  

  
  //头像上传
layui.use('upload', function(){
  var upload = layui.upload;
   
    //普通图片上传
  var uploadInst = upload.render({
    elem: '#test1'
    ,url: "{:url('Base/imgupload')}" //改成您自己的上传接口
    ,data:{upurl:'/public/upload/userimages'}
    ,before: function(obj){
      //预读本地文件示例，不支持ie8
      
    }
    ,done: function(res){
      //如果上传失败
      if(res.code == 1){
         $('#demo1').attr('src', res.photo); 
		 $("#photo").val(res.photo);
        return layer.msg('上传成功!');
      }else{
          return layer.msg('上传失败!');
      }
      //上传成功
    }
    ,error: function(){
      //演示失败状态，并实现重传
      var demoText = $('#demoText');
      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
      demoText.find('.demo-reload').on('click', function(){
        uploadInst.upload();
      });
    }
  });
});


    
  </script>
</body>
</html>
